package com.sqlquery.demo.service.Impl;
import com.sqlquery.demo.dao.UserDao;
import com.sqlquery.demo.entity.*;
import com.sqlquery.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class UserSErviceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Override
    public List<Map<String, Object>> findByName(String name) {
        return userDao.findByName(name);
    }
    @Override
    public User findById(Integer id) {
        return userDao.findById(id);
    }
    @Override
    public List<Map<String, Object>> findRoleByUserName(String name) {
        return userDao.findRoleByUserName(name);
    }
    @Override
    public List<Map<String, Object>> findUserByRoleName(String name) {
        return userDao.findUserByRoleName(name);
    }
    @Override
    public int deleteId(Integer id) {
        return userDao.delete(id);
    }
    @Override
    public int addUser(User user) {
        return userDao.add(user);
    }
    @Override
    public int addRoleById(User_Role user_role) {
        return userDao.addRoleById(user_role);
    }
    @Override
    public int delRoleById(User_Role user_role) {
        return userDao.delRoleById(user_role);
    }
    @Override
    public int updateUser(User user) {
        return userDao.update(user);
    }
    @Override
    public List<Map<String, Object>> findRoleByUserId(Integer id) {
        return userDao.findRoleByUserId(id);
    }
    @Override
    public List<Map<String, Object>> findUserByRoleId(Integer id) {
        return userDao.findUserByRoleId(id);
    }
    @Override
    public List<Map<String, Object>> findAll(Integer page) {
        return userDao.findAll(page);
    }
}
